﻿#pragma once
#include <array>
#include <string_view>
#ifdef _WIN32
typedef void* PIPE_HANDLE;
#else
typedef int PIPE_HANDLE;
#endif


typedef std::array<PIPE_HANDLE, 2> PIPES;
class Pipe
{
	static int create_pipe(PIPES &pipe);

	static int write_pipe(std::array<PIPE_HANDLE, 2> &pipe, std::string_view &buf);

	static int read_pipe(std::array<PIPE_HANDLE, 2> &pipe, char *buf, int size);

	static void close_pipe(std::array<PIPE_HANDLE, 2> &pipe);
};

